//
//  JSWaterflowLayout.h
//  01-瀑布流
//
//  Created by 李建舜 on 06/03/2017.
//  Copyright © 2017 李建舜. All rights reserved.
//

#import <UIKit/UIKit.h>

@class JSWaterflowLayout;

@protocol JSWaterflowLayoutDelegate <NSObject>

@required

/**
 计算视图高度
 视图高度 = 视图宽度 * 图片高度 / 图片宽度

 @param waterflowLayout <#waterflowLayout description#>
 @param index <#index description#>
 @param itemWidth <#itemWidth description#>
 @return <#return value description#>
 */
- (CGFloat)waterflowLayout:(UICollectionViewLayout *)waterflowLayout heightForItemAtIndex:(NSInteger)index itemWidth:(CGFloat)itemWidth;


@optional
/** 列数 */
- (NSUInteger)columnCountInWaterflowLayout:(JSWaterflowLayout *)waterflowLayout;
/** 每一列之间的间距 */
- (CGFloat)columnMarginInWaterflowLayout:(JSWaterflowLayout *)waterflowLayout;
/** 每一行之间的间距 */
- (CGFloat)rowMarginInWaterflowLayout:(JSWaterflowLayout *)waterflowLayout;
/** 边缘间距 */
- (UIEdgeInsets)edgeInsetsInWaterflowLayout:(JSWaterflowLayout *)waterflowLayout;


@end

@interface JSWaterflowLayout : UICollectionViewLayout

/** delegate */
@property (nonatomic, weak) id<JSWaterflowLayoutDelegate> delegate;

@end
